//通过继承Thread类来实现一个线程类
class MyThread extends Thread {
    private int sum = 0;

    public  MyThread (int sum){
        this.sum = sum;
    }
    @Override
    public void run() {
        while(true){
            System.out.println("hello Thread"+sum);
        }
    }
}

public class Text1 {
    public static void main(String[] args) {
        //实例化线程类对象
        Thread t1 = new MyThread(1);
        //通过start来启动t线程，自动执行重写的run方法
        t1.start();

        //实例化线程类对象
        Thread t2 = new MyThread(2);
        //通过start来启动t线程，自动执行重写的run方法
        t2.start();

    }
}
